<ui:composition template="/admin/templates/ui2.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:composite="http://java.sun.com/jsf/composite/primefaces"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:sec="http://www.springframework.org/security/facelets/tags">



    <ui:define name="content">
    
    <div class="entry">
    	<p:toolbar>
            <p:toolbarGroup>
	            <h:outputLabel style="padding-left: 15px;" value="#{commonMsg.currentPositionLabel}员工考勤"></h:outputLabel>
            </p:toolbarGroup>
            <p:toolbarGroup align="right">
					<p:button value="考勤信息" outcome="/admin/checktime/EmployeesClockList"></p:button>
				</p:toolbarGroup>
        </p:toolbar>
        
        <h:form id="form" enctype="multipart/form-data"> 
        	<p:spacer></p:spacer> 
                  <p:panel id="filters">
                  <h:panelGrid columns="8" 
						rowClasses="filter-row" columnClasses="filter-col1,filter-col2">
                    <h:outputLabel style="padding-left: 15px;" value="员工编号"></h:outputLabel>
                    <p:inputText id="jobnumyy" value="#{empCheckCountList.example.jobnum}"></p:inputText>
                    <h:outputLabel style="padding-left: 15px;" value="员工姓名"></h:outputLabel>
                    <p:inputText id="jobnameyy" value="#{empCheckCountList.example.jobname}"></p:inputText>
                    <h:outputLabel style="padding-left: 15px;" value="查询年月"></h:outputLabel>
                    <ui:fragment>
                    <h:selectOneMenu value="#{empCheckCountList.check_year}">
                    	<f:selectItem itemLabel="请选择年份" itemValue=""></f:selectItem>
                    	<f:selectItems var="year" value="#{empCheckUtil.getYears()}" itemLabel="#{year}" itemValue="#{year}"></f:selectItems>
                    </h:selectOneMenu>
                    <h:outputLabel value="年"></h:outputLabel>
                     <h:selectOneMenu value="#{empCheckCountList.check_month}">
                    	<f:selectItem itemLabel="请选择月份" itemValue=""></f:selectItem>
                    	<f:selectItems var="year" value="#{empCheckUtil.getMonths()}" itemLabel="#{year}" itemValue="#{year}"></f:selectItems>
                    </h:selectOneMenu>
                    <h:outputLabel value="月"></h:outputLabel>

					</ui:fragment>
                   
                   
                    <ui:fragment>
                    <p:commandButton update="dataTable" process="filters"
                        value="#{commonMsg.searchLabel}"></p:commandButton>
                    <p:button value="#{commonMsg.resetLabel}" onclick="location.reload();return;"></p:button>
                    </ui:fragment>
                    <p:commandButton process="filters"  update="dataTable"
						action="#{empCheckCountList.countList()}" 
						value="获取考勤汇总"></p:commandButton>
					</h:panelGrid>
                </p:panel>
            <p:dataTable lazy="true" id="dataTable" value="#{empCheckCountList.lazyModel}" var="ecc" 
                paginator="true" paginatorPosition="bottom" rows="50" rowsPerPageTemplate="15,50,100"
                rowKey="#{ecc.id}" sortBy="to_number(ecc.id)" sortOrder="ascending"
                currentPageReportTemplate="#{commonMsg.pageReportTemplate}"
                paginatorTemplate="#{commonMsg.paginatorTemplate}"
                emptyMessage="#{commonMsg.noResultMsg}" selection="#{userList.selectedUsers}">
                
                <!-- <p:column selectionMode="multiple" style="width:18px" exportable="false"/>  -->
<!--                  <p:column sortBy="user.id"> -->
<!--                 	<f:facet name="header"> -->
<!--                 		<h:outputText value="#{commonMsg.IDLabel}"></h:outputText> -->
<!--                 	</f:facet> -->
<!--                     <h:outputText  value="#{user.id}"></h:outputText> -->
<!--                 </p:column>      -->
                <p:column >
                	<f:facet name="header">
                		<h:outputText value="员工工号"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.jobnum}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="考勤月份"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.check_year}-#{ecc.check_month}"></h:outputText>
                </p:column>
                  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="员工姓名"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.jobname}"></h:outputText>
                </p:column>
                           
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="正常打卡"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.normalStatus}"></h:outputText>
                </p:column>
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="迟到"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.late}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="迟到超过一小时"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.lateMoreThanOneHour}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="早上未打卡"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.noMorning}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="晚上未打卡"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.noAfternoon}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="早退"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.leaveEarly}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="无打卡记录"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.noResult}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="休息日"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.holiday}"></h:outputText>
                </p:column>
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="工作日晚加班"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.overtimeNormal}"></h:outputText>
                </p:column>
                
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="休息日加班"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{ecc.overtimeHoliday}"></h:outputText>
                </p:column>
                               
                 <p:column exportable="false">
                 	<p:commandButton type="button" id="checkInfoButton"
	 		            	value="考勤详情"  >
	 		            	<p:ajax listener="#{empCheckCountList.setCondition(ecc.jobnum , ecc.check_year , ecc.check_month)}" update=":form:checkInfoDlg" oncomplete="checkInfoDialog.show()" event="click"></p:ajax>
	 		            </p:commandButton> 
	 		           
                 </p:column>
                 <f:facet name="footer"> 		           		            
					<p:commandButton value="导出Excel" ajax="false">
						<p:dataExporter target="dataTable" type="xls" fileName="empCheckCount" pageOnly="false"></p:dataExporter>
					</p:commandButton>
 		        </f:facet> 
            </p:dataTable>
           
            <p:dialog id="checkInfoDlg" header="员工考勤详情" widgetVar="checkInfoDialog" modal="true">
            	
 
				 <p:dataTable lazy="true" id="dataTable1"
					value="#{empCheckCountList.infoList}" 
					var="eci" 
					paginator="true"
					paginatorPosition="bottom" rows="15"
					currentPageReportTemplate="#{commonMsg.pageReportTemplate}"
					paginatorTemplate="#{commonMsg.paginatorTemplate}"
					emptyMessage="#{commonMsg.noResultMsg}">

					<p:column>
                	<f:facet name="header">
                		<h:outputText value="员工工号"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.jobnum}"></h:outputText>
                </p:column>  
                <p:column sortBy="eci.check_day">
                	<f:facet name="header">
                		<h:outputText value="日期"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.check_year}-#{eci.check_month}-#{eci.check_day}"></h:outputText>
                </p:column>
                  
                <p:column sortBy="eci.jobname">
                	<f:facet name="header">
                		<h:outputText value="名字"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.jobname}"></h:outputText>
                </p:column>
                
                            
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="上班打卡时间"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.mintime}"></h:outputText>
                </p:column>               
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="下班打卡时间"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.maxtime}"></h:outputText>
                </p:column>   
                 <p:column>
                	<f:facet name="header">
                		<h:outputText value="打卡的状态"></h:outputText>
                	</f:facet>
                    <h:outputText value="#{eci.checkstatus}"/>
                </p:column>      

                <p:column>
                	<f:facet name="header">
                		<h:outputText value="加班"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.workovertime}"></h:outputText>
                </p:column>  
                <p:column>
                	<f:facet name="header">
                		<h:outputText value="加班说明"></h:outputText>
                	</f:facet>
                    <h:outputText  value="#{eci.workovertimeinstruction}"></h:outputText>
                </p:column>  
					</p:dataTable>  
            </p:dialog>
        
            </h:form>
      </div>
    </ui:define> 
</ui:composition>
